import { getCateApi } from '@/api/home'
export default {
  namespaced: true,
  state: {
    // 1. 菜单数据
    list: []
  },
  mutations: {
    // 2. 存储菜单数据
    setList (state, payload) {
      state.list = payload
    }
  },
  actions: {
    // 3. 获取菜单数据
    async getListAction ({ commit }, payload) {
      const { data } = await getCateApi()
      console.log('分类菜单数据：', data)
      commit('setList', data)
    }
  }
}
